<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>
<body>
    <script>
        // var city='';
        // //JavaScript中，任何数值
        // if(city){
        //     alert('ok');
        // }else{
        //     alert('未指定城市');
        // }

        var num=1;
        //判断num是否等于2
        if(num=2){
            console.log('ok');
        }else{
            console.log('error');
        }
    </script>
</body>
</html>